package com.crawler.dao;

import java.sql.ResultSet;
import java.sql.ResultSetMetaData;
import java.sql.SQLException;

import org.apache.commons.dbutils.ResultSetHandler;

public class MyResultSetHandler implements ResultSetHandler<Integer> {

	@Override
	public Integer handle(ResultSet rs) throws SQLException {
        if (!rs.next()) {
            return null;
        }	
        ResultSetMetaData meta = rs.getMetaData();
        int cols = meta.getColumnCount();
		return rs.getBigDecimal(cols).intValue();
	}

}
